.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source.  A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright 2015 Joyent, Inc.
.\"
.Dd May 11, 2016
.Dt PLWP_GETXREGS 3PROC
.Os
.Sh NAME
.Nm Plwp_getxregs ,
.Nm Plwp_setxregs
.Nd get and set extended register state
.Sh LIBRARY
.Lb libproc
.Sh SYNOPSIS
.In libproc.h
.Ft int
.Fo Plwp_getxregs
.Fa "struct ps_prochandle *P"
.Fa "lwpid_t lwpid"
.Fa "prxregset_t *xregs"
.Fc
.Ft int
.Fo Plwp_setxregs
.Fa "struct ps_prochandle *P"
.Fa "lwpid_t lwpid"
.Fa "const prxregset_t *xregs"
.Fc
.Sh DESCRIPTION
The
.Fn Plwp_getxregs
and
.Fn Plwp_setxregs
functions get and set the extended register state of the thread
.Fa lwpid
in the process handle
.Fa P .
.Pp
The extended register state is defined by the architecture.
These registers may refer to optional registers that have become common on the
platform, but are not part of the standard ABI and thus not covered by
functions such as
.Xr Plwp_getregs 3PROC
and
.Xr Plwp_getfpregs 3PROC .
.Pp
The
.Fn Plwp_getxregs
function gets the extended register state information and places it into
.Fa xregs .
Where as the
.Fn Plwp_setxregs
function sets the extended register state information in
.Fa xregs
for the process handle
.Fa P .
.Pp
Processes must be stopped prior to obtaining the register state of
individual threads.
Processes may be stopped with
.Xr Pstop 3PROC .
.Pp
The
.Sy prxregset_t
structure is described in
.Xr proc 5 .
.Pp
One may not set the register values of a process that is not an active
process, e.g. a process handle that refers to a file or a core file.
.Sh RETURN VALUES
Upon successful completion, the
.Fn Plwp_getxregs
and
.Fn Plwp_setxregs
functions return
.Sy 0
and get or set the register state.
Otherwise,
.Sy -1
is returned and
.Sy errno
is set to indicate the error.
.Sh ERRORS
For a full list of possible errors see the
.Sy DIAGNOSTICS
section in
.Xr proc 5 .
.Pp
The
.Fn Plwp_getxregs
and
.Fn Plwp_setxregs
function will fail if:
.Bl -tag -width Er
.It Er ENODATA
The process handle
.Fa P
does not have any extended register state information.
.It Er EBUSY
The process handle
.Fa P
refers to a live process and it is not stopped.
.It Er ENOENT
The process handle
.Fa P
refers to a live process and there is no thread with id
.Fa lwpid .
.It Er EINVAL
The process handle
.Fa P
refers to a core file and there is no thread with id
.Fa lwpid .
.El
.Sh ARCHITECTURE
The
.Fn Plwp_getxregs
and
.Fn Plwp_setxregs
functions are only available on
.Sy SPARC
platforms.
.Sh INTERFACE STABILITY
.Sy Uncommitted
.Sh MT-LEVEL
See
.Sy LOCKING
in
.Xr libproc 3LIB .
.Sh SEE ALSO
.Xr libproc 3LIB ,
.Xr Plwp_getfpregs 3PROC ,
.Xr Plwp_getregs 3PROC ,
.Xr Plwp_setfpregs 3PROC ,
.Xr Plwp_setregs 3PROC ,
.Xr Pstop 3PROC ,
.Xr proc 5
